package cn.jaye.fabric.controller;

import cn.jaye.fabric.application.MChainCodeApplicationService;
import cn.jaye.fabric.application.command.mchaincode.InfoMChaincodeCommand;
import cn.jaye.fabric.application.command.mchaincode.ListMChaincodeCommand;
import cn.jaye.fabric.common.util.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Jaye
 * @create 2018-05-25 13:56
 */
@RestController
@RequestMapping("/mchaincode")
public class MChainCodeController {

    @Autowired
    private MChainCodeApplicationService mChainCodeApplicationService;

    @PostMapping(value = "list")
    public String list(@RequestBody ListMChaincodeCommand listMChaincodeCommand) {
        return ResultUtil.success(mChainCodeApplicationService.list(listMChaincodeCommand));
    }

    @PostMapping(value = "info")
    public String info(@RequestBody InfoMChaincodeCommand infoMChaincodeCommand) {
        return ResultUtil.success(mChainCodeApplicationService.info(infoMChaincodeCommand));
    }
}
